package com.vidyu.datalayer.dataaccesscomponents.impl;

import com.vidyu.businesslayer.businessentities.MonitorEvent;
import com.vidyu.datalayer.dataaccesscomponents.MonitorEventDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by IntelliJ IDEA.
 * User: eyalsa
 * Date: 28/02/12
 * Time: 14:38
 * Implementation Dao object for Monitor Event
 */

@SuppressWarnings({"unchecked", "UnusedDeclaration"})
@Repository("monitorEventDao")
public class MonitorEventDaoImpl implements MonitorEventDao {

    @Autowired
    private HibernateTemplate template;

    @Override
    @Transactional(readOnly = false, propagation = Propagation.NESTED)
    public long save(MonitorEvent monitorEvent){
        return ((Long) template.save(monitorEvent));
    }

    @Override
    public MonitorEvent findById(long id) {
        return template.get(MonitorEvent.class, id);
    }


}
